<template>
	<view class="resale">
		<!-- #ifdef APP-PLUS -->
		<Hearder :name="'转拍'"></Hearder>
		<!-- #endif -->
		<view class="goods-con bgbottom">
			<image :src="info.goods_image"></image>
			<view class="gro">
				<view>{{info.goods_name}}</view>
				<view>支付金额:<text>￥{{info.goods_price}}</text></view>
			</view>
		</view>
		<view class="int_o bgbottom">
			<view class="item">
				<view class="i_left">商品名称</view>
				<view class="i_right" style="width: 80%;">{{info.goods_name}}</view>
			</view>
			<view class="item">
				<view class="i_left">订单号</view>
				<view class="i_right">{{info.order_no}}</view>
			</view>
			<view class="item">
				<view class="i_left">商品价格</view>
				<view class="i_right">￥{{info.goods_price}}</view>
			</view>
			<view class="item">
				<view class="i_left">上架价格</view>
				<view class="i_right">￥{{info.consignment_goods_price}}</view>
			</view>
			<view class="item">
				<view class="i_left">上架费</view>
				<view class="i_right">积分：{{info.e_price}}</view>
			</view>
			<view class="item">
				<view class="i_left">预计收益</view>
				<view class="i_right">￥{{info.profit_price}}</view>
			</view>
		</view>
<!--		<view class="ptbcon bgbottom" @click="toPage('/pages/personal/invest')">-->
<!--			<view>-->
<!--				<image src="/static/images/ptb.png"></image>-->
<!--				{{changename.div_price_name}}支付-->
<!--				<text> (￥{{info.member_amount}})</text>-->
<!--			</view>-->
<!--			<view>-->
<!--				<text v-if="info.open_recharge_amount==1">去充值</text>-->
<!--				<u-icon name="arrow-right" color="#323232" size="14"></u-icon>-->
<!--			</view>-->
<!--		</view>-->
		<view class="btn_box clearfix">
			<view @click="quxiao">取消支付</view>
			<view @click="paysubmit">立即支付</view>
		</view>
		<Paypwd ref="paystatus" :totalprice="info.e_price" @paymoney="paymoney"></Paypwd>
	</view>
</template>

<script>
	import Paypwd from '@/pages/common/paypwd.vue'
	export default {
		data() {
			return {
				order_id:'',
				info:{},
				changename:{}
			}
		},
		onLoad(e) {
			this.order_id = e.order_id
		},
		onShow() {
			this.request('/order/getServiceCharge',{order_id:this.order_id}).then(res=>{
				if(res.data.code == 1){
					this.info = res.data.data
				}
			})
			this.request('/index/getSpaceSetting').then(res => {
				if(res.data.code==1){
					this.changename = res.data.data
				}
			})
		},
		methods: {
			paysubmit(){
				this.request('/member/getIsPayPassword').then(res => {
					if(res.data.code==1){
						if(res.data.data==0){
							this.$refs.paystatus.payflag = true
						}else{
							this.totalprice = this.price
							this.$refs.paystatus.zhifuflag = true
						}
					}else{
						this.$tip(res.data.msg)
					}
				})
			},
			// 支付
			paymoney(){
				this.request('/order/toServiceCharge',{order_id:this.order_id}).then(res => {
					if(res.data.code==1){
						this.request('/pay/balancePay',{trade_no:res.data.data.order_sn}).then(res => {
							if(res.data.code==1){
								this.$tip(res.data.msg)
								this.$refs.paystatus.zhifuflag = false
								setTimeout(()=>{
									uni.navigateBack()
								},500)
							}else{
								this.$tip(res.data.msg)
							}
						})
					}else{
						this.$tip(res.data.msg)
					}
				})
			},
			toPage(route){
				if(this.info.open_recharge_amount==1){
					uni.navigateTo({
					    url: route
					});
				}
			},
			quxiao(){
				uni.navigateBack()
			}
		},
		components:{
			Paypwd
		}
	}
</script>

<style scoped lang="scss">
	.resale{
		.goods-con{
			padding: 34rpx 3%;
			display: flex;
			justify-content: space-between;
			align-items: center;
			image{
				width: 160rpx;
				height: 160rpx;
			}
			.gro{
				height: 160rpx;
				width: calc(100% - 180rpx);
				display: flex;
				justify-content: space-between;
				flex-direction: column;
				margin-left: 20rpx;
				view{
					&:first-of-type{
						font-weight: 800;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
					}
					&:last-of-type{
						font-size: 28rpx;
						text{
							color: $uni-text-color;
							font-weight: 800;
						}
					}
				}
			}
		}
		.int_o{
			padding: 0 4%;
			.item{
				display: flex;
				justify-content: space-between;
				align-items: center;
				height: 100rpx;
				.i_left{
					font-size: 28rpx;
				}
			}
		}
		.ptbcon{
			display: flex;
			justify-content: space-between;
			align-items: center;
			height: 112rpx;
			padding: 0 4%;
			>view{
				font-size: 28rpx;
				&:last-of-type{
					margin-top: 4rpx;
					text{
						color: $uni-item-color;
						font-size: 28rpx;
					}
					.u-icon{
						margin-left: 6rpx;
					}
				}
				image{
					position: relative;
					top: 2rpx;
					width: 44rpx;
					height: 44rpx;
					vertical-align: bottom;
					margin-right: 20rpx;
				}
				text{
					font-size: 28rpx;
					color: #999;
				}
			}
		}
		.btn_box{
			width: 688rpx;
			margin: 40rpx auto;
			view{
				float: left;
				width: 330rpx;
				height: 80rpx;
				border-radius: 4rpx;
				text-align: center;
				line-height: 80rpx;
				border: 1rpx solid $uni-item-color;
				color: $uni-item-color;
				&:last-of-type{
					margin-left: 20rpx;
					background: $uni-item-color;
					color: #fff;
				}
			}
		}
	}
</style>
